package MOLE.Bill;

import java.util.*;
import MOLE.*;

/** 
 Bill ��ժҪ˵����
 
 
*/

public class Bill extends MOLE.App.Every
{
	public int BillID = 0;
	//	public int Uid=0;
	public int BillOwner = 0;
	public String BillStatus = "";
	public double BillValue = 0;
	public String Term = "";
	public int BillDataId = 0;
	public double BingoValue = 0;
	public int Playid = 0;
	public String Number = "";
	public int Zhushor = 0;
	public int Beishor = 1;
	public String Groupid = "1000";
	public int DataId = 0;
	public long UserNum = 0; //agetn's user id
	public String UserName = "";
	public double UnitPrice = 2;
	public String Statu = "";
//	public ind DataId=0;

	public Bill(int billId)
	{
		//
		// TODO: �ڴ˴���ӹ��캯���߼�
		//
		BillID = billId;
		_Ini();



	}

	public Bill()
	{
	}


	public final void _Ini()
	{
		String sql = "exec lotto_list " + String.valueOf(BillID);
		DataTable dt = MOLE.SQL.GetDataTable(sql);
		if (dt.Rows.size() == 0)
		{
		}
		else
		{
			BillValue = Double.parseDouble(dt.Rows[0]["totalprice"].toString().trim());
			BillOwner = Integer.parseInt(dt.Rows[0]["hy_num"].toString().trim());
			BillStatus = dt.Rows[0]["Zt"].toString().trim().trim();
			Term = dt.Rows[0]["qihao"].toString().trim().trim();
		//	BillDataId=Convert.ToInt32(   dt.Rows[0]["data_id"].ToString().Trim()  );
			BingoValue = Double.parseDouble(dt.Rows[0]["zj_jiangjin"].toString().trim());
			Statu = dt.Rows[0]["zt"].toString().trim();
			Playid = Integer.parseInt(dt.Rows[0]["caizhong_id2"].toString().trim());
			Zhushor = Integer.parseInt(dt.Rows[0]["multiple"].toString().trim());
			Number = dt.Rows[0]["number"].toString().trim();
		}

	}




	//		public ArrayList  AddSingle(string number,string groupId)
	//		{
	//			
	//			 
	//		}

	//Ͷע
	public final ArrayList _Teuzhu()
	{
		GetZhushorAndPrice();
		ArrayList teuzhu = TeuzhuOnly();
		ArrayList pay = PayOnly("����" + String.valueOf(Zhushor) + "ע");
		ArrayList a = MOLE.comm.HabinArraylist(teuzhu, pay);
		return a;

	}

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region
	public final void GetZhushorAndPrice()
	{
		Zhushor = MOLE.Bill.Comm.GetMultiZhuBaseSingleselectByPlayid(Playid, Number);
		BillValue = Zhushor * Beishor * UnitPrice;
	}
	public final ArrayList TeuzhuOnly()
	{
		 MOLE.SQLOS o = new MOLE.SQLOS("agentdg");
		o.RS("agent_id", BillOwner);
		o.RS("data_id", DataId); //no dataid
		o.RS("Zhushu", Zhushor);
		 o.RS("CaiZhong_Id", "");
		o.RS("User_Num", UserNum); // no thist
		o.RS("user_name", UserName); //no this
		o.RS("Play_id", Playid);
		o.RS("Term_Code", Term);
		o.RS("Number", Number);
		o.RS("Multiple", Beishor);
		o.RS("unitprice", 2);
		o.RS("totalprice", BillValue);
		o.RS("AdGroupId", Groupid);
		o.RS("caiz_name", MOLE.Bill.Comm._GetBillTypeName(Playid)); //no nesscery
		ArrayList a = o.InserTrans();
		 return a;
	}

	public final ArrayList PayOnly(String payDemo)
	{
		ArrayList a = (new MOLE.App.Account(BillOwner))._Pay(BillValue, payDemo);
		return a;
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion


	public final ArrayList _Chwpyao()
	{
		ArrayList c = new ArrayList();
		if (Statu.equals(MOLE.Bill.BillResx.BillStatu_wait))
		{
			ArrayList a = ChwpyaoOnly();
			ArrayList b = ChwpyaoFandian();
			  c = MOLE.comm.HabinArraylist(a, b);
		}

		return c;

	}

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region
	 public final ArrayList ChwpyaoOnly()
	 {
		ArrayList a = new ArrayList();
		MOLE.SQLOS o = new SQLOS("agentdg");
		o.RS("zt", BillResx.BillStatu_checkpass);
		a.add(o.UpdateTrans("adid", BillID));
		return a;
	 }
	public final double GetFandianMoney()
	{
		MOLE.Bill.User u = new MOLE.Bill.User(BillOwner);

		return u.FandianBili * BillValue;
	}

	public final ArrayList ChwpyaoFandian()
	{
		double fandianMoney = GetFandianMoney();
		 App.Account o = new MOLE.App.Account(BillOwner);
		ArrayList a = o._Charge(fandianMoney, BillResx.ChareDemo_ChwpyaoFedyer);
		return a;
	}



//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion

	//������Ʊ
	 public final ArrayList _Giveup()
	 {
		ArrayList a = GiveupOnly();
		ArrayList b = GiveupCharge();
		ArrayList c = MOLE.comm.HabinArraylist(a, b);
		return c;

	 }

	public final void Giveup()
	{
		String s = "exec Lotto_Giveup " + BillID;
		DataTable d = MOLE.SQL.GetDataTable(s);
		if (d.Rows[0]["result"].toString().equals("ok"))
		{
			this.StausCode = 0;
			this.StausMsg = "ok";
		}
		else
		{
			this.StausCode = 1;
			this.StausMsg = d.Rows[0]["result"].toString().toLowerCase().trim();
		}
	}

	public final void Giveup_limit()
	{
		String s = "exec Lotto_Giveup " + BillID;
		DataTable d = MOLE.SQL.GetDataTable(s);
		if (d.Rows[0]["result"].toString().equals("ok"))
		{
			this.StausCode = 0;
			this.StausMsg = "ok";
		}
		else
		{
			this.StausCode = 1;
			this.StausMsg = d.Rows[0]["result"].toString().toLowerCase().trim();
		}
	}



//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region
	public final ArrayList GiveupOnly()
	{
		ArrayList a = new ArrayList();
		MOLE.SQLOS o = new SQLOS("agentdg");
		o.RS("zt", BillResx.BillStatu_checkout);
		 a.add(o.UpdateTrans("adid", BillID));
		return a;
	}

	public final ArrayList GiveupCharge()
	{
		App.Account o = new MOLE.App.Account(BillOwner);
		ArrayList a = o._Charge(BillValue, BillResx.BillStatu_checkoutChargeDemo);
		return a;

	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion



	public final void _Dweijeo()
	{
//		   string bingo=	new MOLE.Bill.Term( Term ).BingoNumber;
//			if(
	}
	public final void DweijeoFejeo()
	{


	}


	public final void None()
	{
	}






}